// #ifdef H5
import JSEncryptLong from 'encryptlong/bin/jsencrypt'
 // #endif
 // #ifndef H5
 import JSEncryptLong from '@/utils/jsencryptLong.js'
  // #endif

/***************数据密钥***********************************/
//公钥
const PUBLIC_DATA_KEY = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCf3fN69OHDgDvAAna+ZqewnGOgTt3WVlHggT5YSLHnDgy40vles0mM6X+IeexotrWViVhzw+NLDfo4WIp3hbZJQL6ZsrLytKh7Mz3XClaRyE0lrTEkQq7sPRZGa0fYMaFdJH5BnBfsEd1sSPIiCxpCymtLr9VzTMDrcKUPk5aZiwIDAQAB';
//私钥
const PRIVATE_DATA_KEY = 'MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAJ/d83r04cOAO8ACdr5mp7CcY6BO3dZWUeCBPlhIsecODLjS+V6zSYzpf4h57Gi2tZWJWHPD40sN+jhYineFtklAvpmysvK0qHszPdcKVpHITSWtMSRCruw9FkZrR9gxoV0kfkGcF+wR3WxI8iILGkLKa0uv1XNMwOtwpQ+TlpmLAgMBAAECgYEAkxjYhhR4/zgowj4CIKO4PGtJyCGJQUTfxaFmSjlpaF6nGhEV3ys8y+m1rU/yVU94uYVM3AgsRc0wpVPi5KMl27/+ZMPUxvAen+LyvmhPU+/G7AmM3m0wsB73NatdXPhdK28xSsDjMpEjKCpfVUPFuTdD9J37z9mmUHeDHuvLGYECQQDZEMTozBaGSOK/eVbORd8lbLcHG/xXC6HmCo32wtnQ/Ydt1UIteFetz3Gyfs96/7Qh5/YiaUf92mV/I/vmg7QhAkEAvIq8gS6I0RBI6gNxx3cIrwpB+B+ZdwggrZoN4Gnj56yBK81FFGk1S3M064udm0pHWZrctL2cl4/z3QbRpAxYKwJBALdePim29rQ78Cj2VQlt5yMTYs6DqrjR39OYSPMTCbRN6FE1XXFR/yeaXZ7/F0D9r+sQrFHHhISDMUilWlASJGECQChOGEIdao4Wxx+PoPEdFzQkIzohtzLk/+dcuX6x5FCQZgSxGwVkAEqi1DtOW2DpHhufqXLR3fnggidL3+EL6oUCQQCCBbbqimdCtxNMthz++j4nzgILAK2L4zQU/SR1YZBs7Fg5gqeZ2pRTRIZNItj985d1DL120TWf2ik3Wo36QUBF';
/* 加密 */
export function encryptLong(data) {
    var encryptor = new JSEncryptLong()
	encryptor.setPublicKey(PUBLIC_DATA_KEY);
    // 如果是对象/数组的话，需要先JSON.stringify转换成字符串
    const result = encryptor.encryptLong(data)
    return result
}
/**
 * 解密
 * @param {Object} data
 */
export function decryptLong(data) {
    var encryptor = new JSEncryptLong()
    encryptor.setPrivateKey(PRIVATE_DATA_KEY)
    var result = encryptor.decryptLong(data)
    return result
}
// token
export function syShopSign() {
  const sign = '1oOP3ykFDI0K6ifmtvU7c8Y1eTWZSlyl'

  return sign
}


export function getUuid() {
	var s = [];
	var hexDigits = "0123456789abcdef";
	for (var i = 0; i < 32; i++) {
		s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
	}
	s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
	s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
	s[8] = s[13] = s[18] = s[23];
	var uuid = s.join("");
	return uuid;
}

